//
//  ViewController.swift
//  Test
//
//  Created by alyadan on 2017/3/8.
//  Copyright © 2017年 alyadan. All rights reserved.
//

import UIKit
import YD_NetworkModule
import YD_DataModel
import ObjectMapper
import RxSwift
import SwiftyJSON

class ViewController: UIViewController {

    let disposeBag = DisposeBag()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        yd_network.request(url: "/test")
            .subscribe(onNext: { (data: [String : Any], origin: [String : JSON]?) in
                print(data)
            }, onError: { (err) in
                print(err)
            }).disposed(by: disposeBag)
        // Do any additional setup after loading the view, typically from a nib.
        
//        BannerAdDataModel.fetchModel(url: "/home/new/data", isList: true, dataKeyPath: "banner_ad")
//            .subscribe(onNext: { (data: (Any, [String : JSON]?)) in
//                print(data)
//            }, onError: { (err) in
//                print(err)
//            }).disposed(by: disposeBag)
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}


class BannerAdDataModel: YD_DataModel {
    var id: Int?

    override func mapping(map: Map) {
        id <- map["id"]
    }
}
